<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/**
<span class='line'>  2</span>  * Constructs a new label mark with default properties. Labels are not typically
<span class='line'>  3</span>  * constructed directly, but by adding to a panel or an existing mark via
<span class='line'>  4</span>  * {@link pv.Mark#add}.
<span class='line'>  5</span>  *
<span class='line'>  6</span>  * @class Represents a text label, allowing textual annotation of other marks or
<span class='line'>  7</span>  * arbitrary text within the visualization. The character data must be plain
<span class='line'>  8</span>  * text (unicode), though the text can be styled using the {@link #font}
<span class='line'>  9</span>  * property. If rich text is needed, external HTML elements can be overlaid on
<span class='line'> 10</span>  * the canvas by hand.
<span class='line'> 11</span>  *
<span class='line'> 12</span>  * &lt;p>Labels are positioned using the box model, similarly to {@link Dot}. Thus,
<span class='line'> 13</span>  * a label has no width or height, but merely a text anchor location. The text
<span class='line'> 14</span>  * is positioned relative to this anchor location based on the
<span class='line'> 15</span>  * {@link #textAlign}, {@link #textBaseline} and {@link #textMargin} properties.
<span class='line'> 16</span>  * Furthermore, the text may be rotated using {@link #textAngle}.
<span class='line'> 17</span>  *
<span class='line'> 18</span>  * &lt;p>Labels ignore events, so as to not interfere with event handlers on
<span class='line'> 19</span>  * underlying marks, such as bars. In the future, we may support event handlers
<span class='line'> 20</span>  * on labels.
<span class='line'> 21</span>  *
<span class='line'> 22</span>  * &lt;p>See also the &lt;a href="../../api/Label.html">Label guide&lt;/a>.
<span class='line'> 23</span>  *
<span class='line'> 24</span>  * @extends pv.Mark
<span class='line'> 25</span>  */</span><span class="WHIT">
<span class='line'> 26</span> </span><span class="NAME">pv.Label</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 27</span> </span><span class="WHIT">  </span><span class="NAME">pv.Mark.call</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 28</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 29</span> 
<span class='line'> 30</span> </span><span class="NAME">pv.Label.prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pv.extend</span><span class="PUNC">(</span><span class="NAME">pv.Mark</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 31</span> </span><span class="WHIT">    </span><span class="PUNC">.</span><span class="NAME">property</span><span class="PUNC">(</span><span class="STRN">"text"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 32</span> </span><span class="WHIT">    </span><span class="PUNC">.</span><span class="NAME">property</span><span class="PUNC">(</span><span class="STRN">"font"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 33</span> </span><span class="WHIT">    </span><span class="PUNC">.</span><span class="NAME">property</span><span class="PUNC">(</span><span class="STRN">"textAngle"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 34</span> </span><span class="WHIT">    </span><span class="PUNC">.</span><span class="NAME">property</span><span class="PUNC">(</span><span class="STRN">"textStyle"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 35</span> </span><span class="WHIT">    </span><span class="PUNC">.</span><span class="NAME">property</span><span class="PUNC">(</span><span class="STRN">"textAlign"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 36</span> </span><span class="WHIT">    </span><span class="PUNC">.</span><span class="NAME">property</span><span class="PUNC">(</span><span class="STRN">"textBaseline"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 37</span> </span><span class="WHIT">    </span><span class="PUNC">.</span><span class="NAME">property</span><span class="PUNC">(</span><span class="STRN">"textMargin"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 38</span> </span><span class="WHIT">    </span><span class="PUNC">.</span><span class="NAME">property</span><span class="PUNC">(</span><span class="STRN">"textShadow"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 39</span> 
<span class='line'> 40</span> </span><span class="NAME">pv.Label.prototype.type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"label"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 41</span> 
<span class='line'> 42</span> </span><span class="COMM">/**
<span class='line'> 43</span>  * The character data to render; a string. The default value of the text
<span class='line'> 44</span>  * property is the identity function, meaning the label's associated datum will
<span class='line'> 45</span>  * be rendered using its &lt;tt>toString&lt;/tt>.
<span class='line'> 46</span>  *
<span class='line'> 47</span>  * @type string
<span class='line'> 48</span>  * @name pv.Label.prototype.text
<span class='line'> 49</span>  */</span><span class="WHIT">
<span class='line'> 50</span> 
<span class='line'> 51</span> </span><span class="COMM">/**
<span class='line'> 52</span>  * The font format, per the CSS Level 2 specification. The default font is "10px
<span class='line'> 53</span>  * sans-serif", for consistency with the HTML 5 canvas element specification.
<span class='line'> 54</span>  * Note that since text is not wrapped, any line-height property will be
<span class='line'> 55</span>  * ignored. The other font-style, font-variant, font-weight, font-size and
<span class='line'> 56</span>  * font-family properties are supported.
<span class='line'> 57</span>  *
<span class='line'> 58</span>  * @see &lt;a href="http://www.w3.org/TR/CSS2/fonts.html#font-shorthand">CSS2 fonts&lt;/a>
<span class='line'> 59</span>  * @type string
<span class='line'> 60</span>  * @name pv.Label.prototype.font
<span class='line'> 61</span>  */</span><span class="WHIT">
<span class='line'> 62</span> 
<span class='line'> 63</span> </span><span class="COMM">/**
<span class='line'> 64</span>  * The rotation angle, in radians. Text is rotated clockwise relative to the
<span class='line'> 65</span>  * anchor location. For example, with the default left alignment, an angle of
<span class='line'> 66</span>  * Math.PI / 2 causes text to proceed downwards. The default angle is zero.
<span class='line'> 67</span>  *
<span class='line'> 68</span>  * @type number
<span class='line'> 69</span>  * @name pv.Label.prototype.textAngle
<span class='line'> 70</span>  */</span><span class="WHIT">
<span class='line'> 71</span> 
<span class='line'> 72</span> </span><span class="COMM">/**
<span class='line'> 73</span>  * The text color. The name "textStyle" is used for consistency with "fillStyle"
<span class='line'> 74</span>  * and "strokeStyle", although it might be better to rename this property (and
<span class='line'> 75</span>  * perhaps use the same name as "strokeStyle"). The default color is black.
<span class='line'> 76</span>  *
<span class='line'> 77</span>  * @type string
<span class='line'> 78</span>  * @name pv.Label.prototype.textStyle
<span class='line'> 79</span>  * @see pv.color
<span class='line'> 80</span>  */</span><span class="WHIT">
<span class='line'> 81</span> 
<span class='line'> 82</span> </span><span class="COMM">/**
<span class='line'> 83</span>  * The horizontal text alignment. One of:&lt;ul>
<span class='line'> 84</span>  *
<span class='line'> 85</span>  * &lt;li>left
<span class='line'> 86</span>  * &lt;li>center
<span class='line'> 87</span>  * &lt;li>right
<span class='line'> 88</span>  *
<span class='line'> 89</span>  * &lt;/ul>The default horizontal alignment is left.
<span class='line'> 90</span>  *
<span class='line'> 91</span>  * @type string
<span class='line'> 92</span>  * @name pv.Label.prototype.textAlign
<span class='line'> 93</span>  */</span><span class="WHIT">
<span class='line'> 94</span> 
<span class='line'> 95</span> </span><span class="COMM">/**
<span class='line'> 96</span>  * The vertical text alignment. One of:&lt;ul>
<span class='line'> 97</span>  *
<span class='line'> 98</span>  * &lt;li>top
<span class='line'> 99</span>  * &lt;li>middle
<span class='line'>100</span>  * &lt;li>bottom
<span class='line'>101</span>  *
<span class='line'>102</span>  * &lt;/ul>The default vertical alignment is bottom.
<span class='line'>103</span>  *
<span class='line'>104</span>  * @type string
<span class='line'>105</span>  * @name pv.Label.prototype.textBaseline
<span class='line'>106</span>  */</span><span class="WHIT">
<span class='line'>107</span> 
<span class='line'>108</span> </span><span class="COMM">/**
<span class='line'>109</span>  * The text margin; may be specified in pixels, or in font-dependent units (such
<span class='line'>110</span>  * as ".1ex"). The margin can be used to pad text away from its anchor location,
<span class='line'>111</span>  * in a direction dependent on the horizontal and vertical alignment
<span class='line'>112</span>  * properties. For example, if the text is left- and middle-aligned, the margin
<span class='line'>113</span>  * shifts the text to the right. The default margin is 3 pixels.
<span class='line'>114</span>  *
<span class='line'>115</span>  * @type number
<span class='line'>116</span>  * @name pv.Label.prototype.textMargin
<span class='line'>117</span>  */</span><span class="WHIT">
<span class='line'>118</span> 
<span class='line'>119</span> </span><span class="COMM">/**
<span class='line'>120</span>  * A list of shadow effects to be applied to text, per the CSS Text Level 3
<span class='line'>121</span>  * text-shadow property. An example specification is "0.1em 0.1em 0.1em
<span class='line'>122</span>  * rgba(0,0,0,.5)"; the first length is the horizontal offset, the second the
<span class='line'>123</span>  * vertical offset, and the third the blur radius.
<span class='line'>124</span>  *
<span class='line'>125</span>  * @see &lt;a href="http://www.w3.org/TR/css3-text/#text-shadow">CSS3 text&lt;/a>
<span class='line'>126</span>  * @type string
<span class='line'>127</span>  * @name pv.Label.prototype.textShadow
<span class='line'>128</span>  */</span><span class="WHIT">
<span class='line'>129</span> 
<span class='line'>130</span> </span><span class="COMM">/**
<span class='line'>131</span>  * Default properties for labels. See the individual properties for the default
<span class='line'>132</span>  * values.
<span class='line'>133</span>  *
<span class='line'>134</span>  * @type pv.Label
<span class='line'>135</span>  */</span><span class="WHIT">
<span class='line'>136</span> </span><span class="NAME">pv.Label.prototype.defaults</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">pv.Label</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>137</span> </span><span class="WHIT">    </span><span class="PUNC">.</span><span class="NAME">extend</span><span class="PUNC">(</span><span class="NAME">pv.Mark.prototype.defaults</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>138</span> </span><span class="WHIT">    </span><span class="PUNC">.</span><span class="NAME">text</span><span class="PUNC">(</span><span class="NAME">pv.identity</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>139</span> </span><span class="WHIT">    </span><span class="PUNC">.</span><span class="NAME">font</span><span class="PUNC">(</span><span class="STRN">"10px sans-serif"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>140</span> </span><span class="WHIT">    </span><span class="PUNC">.</span><span class="NAME">textAngle</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>141</span> </span><span class="WHIT">    </span><span class="PUNC">.</span><span class="NAME">textStyle</span><span class="PUNC">(</span><span class="STRN">"black"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>142</span> </span><span class="WHIT">    </span><span class="PUNC">.</span><span class="NAME">textAlign</span><span class="PUNC">(</span><span class="STRN">"left"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>143</span> </span><span class="WHIT">    </span><span class="PUNC">.</span><span class="NAME">textBaseline</span><span class="PUNC">(</span><span class="STRN">"bottom"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>144</span> </span><span class="WHIT">    </span><span class="PUNC">.</span><span class="NAME">textMargin</span><span class="PUNC">(</span><span class="NUMB">3</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>145</span> </span></pre></body></html>